<?php $this->load->helper('mydate'); ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
    <head>
        <title>EW - Team view</title>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>	
        <style type="text/css">
            * {margin:0;padding:0}
            body {font:12px/16px Arial;padding:10px}
            hr {background: none;border:0;border-bottom: 1px solid #ccc; margin:5px 0}
            th {text-align: left}
            th, td {padding:3px 5px;border:1px solid #e7e7e7}
            input {padding:3px 5px}
        </style>        
    </head>
    <body>
        <div id="wrapper">
            <h3>Team status update</h3>
            
            <br />
            <?php if ($bank != null):?>
            <p><span style="padding:5px;border:1px solid red;background:yellow">Bank report: <?php echo 'Crystal: <b>'.number_format($bank->res1).'</b>. Gas: <b>'.number_format($bank->res2).'</b>. Energy: <b>'.number_format($bank->res3).'</b>. Uranium: <b>'.number_format($bank->res4).'</b>'?></span></p>
            <br />
            <?php endif?>
            <em>Click to a column's header to sort by that one</em>. <a href="javascript:location.reload(true)">Refresh now</a>
            <table cellspacing="0">
                <tr style="background:#e2f5ff">
                    <th>#</th>
                    <th>Name</th>
                    <th style="text-align:center"><a href="<?php echo $this->config->item('base_url');?>index/viewTeam?sort=level" title="sort by this column">[Level]</a></th>
                    <th><a href="<?php echo $this->config->item('base_url');?>index/viewTeam?sort=activity" title="sort by this column">[Last level up]</a></th>
                    <th style="text-align:right"><a href="<?php echo $this->config->item('base_url');?>index/viewTeam?sort=deposit" title="sort by this column">[Deposit last 7 days]</a></th>
                </tr>
                <?php $i=0;?>
<?php foreach ($players as $item): ?>
                <?php $i++;?>
                    <tr <?php if ($i%2 ==0) echo 'style="background:#f5f5f5"'?>>
                        <td style="text-align:center"><?php echo $i ?></td>
                        <td><?php echo $item['name'] ?></td>
                        <td style="text-align:center"><?php echo $item['level'] ?></td>
                        <td><?php if ($item['last_activity_time'])
                                echo time_ago($item['last_activity_time']) ?></td>
                        <td style="text-align:right"><?php echo number_format($item['deposit']) ?></td>
                    </tr>
<?php endforeach; ?>
            </table>

        </div>
    </body>
</html>
